package com.example.service;

import lombok.Data;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

@Data
@Component
public class AnotherBean implements InitializingBean {

    private static final Logger logger = LoggerFactory.getLogger(AnotherBean.class);

    private String anotherProperty;

    public AnotherBean() {
        logger.info("AnotherBean constructor called");
    }

    @PostConstruct
    public void postConstruct() {
        logger.info("AnotherBean @PostConstruct method called");
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        logger.info("AnotherBean afterPropertiesSet method called");
    }

    public void init() {
        logger.info("AnotherBean custom init-method called");
    }

    public void performAnotherTask() {
        logger.info("AnotherBean performAnotherTask method called with anotherProperty: {}", anotherProperty);
    }
}
